﻿@model AntUnion.FrameWork.Model.Models.TbSystemConfigTab

@{
    ViewData["Title"] = "Create";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <style>
        .testPicdiv {
            width: 200px;
            height: 100px;
            overflow: auto;
            border: none;
        }

        .layui-input-disabled {
            background-color: #f2f2f2;
        }

        .scrollbar::-webkit-scrollbar { /*滚动条整体样式*/
            width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
            height: 1px;
        }

        .scrollbar::-webkit-scrollbar-thumb { /*滚动条里面小方块*/
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
            background: #009688;
        }

        .scrollbar::-webkit-scrollbar-track { /*滚动条里面轨道*/
            -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
            border-radius: 10px;
            background: #EDEDED;
        }

        .layui-form-label {
            width: 180px !important;
        }

        .layui-input {
            width: 100%;
        }

        .layui-input-block {
            margin-left: 180px !important;
        }

        .layui-input-inline {
            width: 220px !important;
        }
    </style>
    <script src="~/js/CommonHelper.js"></script>
    <script type="text/javascript">
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table', 'form', 'upload', 'laydate'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , upload = layui.upload
                , element = layui.element
                , laydate = layui.laydate
                , parentFrameIndex = parent.layer.getFrameIndex(window.name); //获取窗口索引;
            element.init();
            /* 自定义验证规则 */
            form.verify({
                Title: function (value) {
                    if (value.length == 0) {
                        return '请输入配置分类名称';
                    }
                }
                , EngTitle: function (value) {
                    if (value.length == 0) {
                        return '请输入配置分类英文名称';
                    }
                }
            });

            /* 监听提交 */
            form.on('submit(submit-form)', function (data) {
                var datas = data.field;
                $.ajax({
                    type: "POST",
                    url: "/Console/SystemConfigTab/Edit",
                    data: datas, // 你的formid
                    async: true,
                    error: function (request) {
                        alert("Connection error");
                    },
                    beforeSend: function (xhr) {
                        layui.layer.load();
                    },
                    success: function (data) {
                        var item = eval(data);
                        if (item.code == 0) {
                            layer.msg("编辑成功", { icon: 1, time: 1000 }, function () {
                                parent.layer.close(parentFrameIndex);
                                parent.layui.table.reload("table-datalist");
                            });
                        } else if (item.code == 1) {
                            layer.msg(item.data, { icon: 2 });
                        } else {
                            layer.msg("保存失败", { icon: 0 });
                        }
                        layer.closeAll('loading');
                    }
                });
                return false;
            });


        });
    </script>
}
<div class="layui-fluid">
    <div class="layui-card">
        @*<div class="layui-card-header">编辑模板</div>*@
        <div class="layui-card-body" style="padding: 15px; ">
            <form class="layui-form layui-form-pane" action="" lay-filter="component-form-group">
                <div class="layui-form-item">
                    <label class="layui-form-label">配置分类名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="Title" name="Title" value="@Model.Title" maxlength="2500" lay-verify="Title" placeholder="" autocomplete="off"  disabled="disabled" class="layui-input layui-input-disabled">
                        @Html.HiddenFor(m => m.Id)
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">配置分类英文名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="EngTitle" name="EngTitle" value="@Model.EngTitle" maxlength="120" lay-verify="EngTitle" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">分类状态</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="Status" value="true" title="显示" @Html.Raw(Model.Status == true ? " checked=\"checked\"" : "")>
                            <input type="radio" name="Status" value="false" title="隐藏" @Html.Raw(Model.Status == false ? " checked=\"checked\"" : "")>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="submit-form">立即提交</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>